
var global_play = null;
function cameraVod() {
    if(global_play != null) {
        global_play.pause();
    }
    navigator.device.capture.captureVideo(function(mediaFiles){
        for (var i = 0; i < mediaFiles.length; i++) {
            fileName = mediaFiles[i].fullPath;
            //fileName = fileName.replace("file://", "");
            console.log("fileName:"+fileName);
            var player = new Aliplayer({
                id: "vodId", // 容器id
                source: "https://localhost/"+fileName,  // 视频url 支持互联网可直接访问的视频地址
                autoplay: false,      // 自动播放
                width:"100%",       // 播放器宽度
                height:"200px",      // 播放器高度
                showBarTime:"2000",
                showBuffer:true,
                playsinline:true,
                preload:true,
                "controlBarVisibility": "click",
                skinLayout: [{"name":"bigPlayButton","align":"cc","x":0,"y":0},{"name":"H5Loading","align":"cc"},{"align":"blabs","x":0,"y":0,"name":"controlBar", "children":[{"align":"tlabs","x":0, "y":0,"name":"progress"},{"align":"tl","x":15,"y":26,"name":"playButton"},{"align":"tl", "x":10, "y":24, "name":"timeDisplay"},{ "align":"tr", "x":20, "y":25, "name":"fullScreenButton"},{ "align":"tr", "x":20, "y":25, "name":"setButton"},{ "align":"tr", "x":20, "y":23, "name":"streamButton"},{"align":"tr","x":20,"y":25, "name":"volume"}]}]
            });

            player.on("play", function() {
                //监听播放
                global_play = this;
            });

            player.on("requestFullScreen", function() {
                //全屏播放监听
            });

            player.on("cancelFullScreen", function() {
                //取消全屏播放
            });
            player.play();
        }
    }, function(){
        alert('Error code: ' + error.code);
    },
        {limit:1, duration: 480});
}

function captureImage() {
    navigator.device.capture.captureImage(function(mediaFiles){
        for (var i = 0; i < mediaFiles.length; i++) {
            fileName = mediaFiles[i].fullPath;
            var elem = document.getElementById('idImage');
            elem.src = "https://localhost/"+fileName;
        }
    }, function(){
        alert('Error code: ' + error.code);
    },
        {limit:1, duration: 480});
}

function openAudio() {
    navigator.device.capture.captureAudio(function(mediaFiles){
        for (var i = 0; i < mediaFiles.length; i++) {
            fileName = mediaFiles[i].fullPath;
            var elem = document.getElementById('idAudio');
            elem.src = "https://localhost/"+fileName;
        }
    }, function(){
        alert('Error code: ' + error.code);
    },
        {limit:1, duration: 480});
}

